home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / demograph / getconfig.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  4KB  |  130 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /**************************************************************************** 
  18. getconfig()
  19. by: David B. Ligon
  20. 7/10/89
  21.  
  22.    Getconfig recieves a parameter and passes back TRUE or FALSE, depending on
  23.    whether the the option is installed in your Personal IRIS.  Currently the
  24.    options that are supported include:
  25.  
  26. TURBO        returns TRUE if the turbo graphics option is installed
  27. RE2        returns TRUE if the RE2 graphics processor is installed
  28. ZBUFFER        returns TRUE if the hardware zbuffer option is installed
  29. BITPLANES   returns TRUE if the 24 (8+16) bitplanes option is installed
  30. SMALLSONY   returns TRUE if the 1024x768 monitor is installed
  31. MIPS20        returns TRUE if the 20MHz R3000 option is installed
  32. MEMORY        returns the amount of user memory installed in bytes
  33.  
  34.    See getconfig.h for the defines for these parameters or copy the following:
  35.  
  36. #define TURBO        1
  37. #define RE2        2
  38. #define ZBUFFER        3
  39. #define BITPLANES   4
  40. #define SMALLSONY   5
  41. #define MIPS20        8
  42. #define MEMORY        9
  43. #define PI        10
  44. #define R2300        11
  45.  
  46. *****************************************************************************/
  47.  
  48. #include "invent.h"
  49. #include "getconfig.h"
  50.  
  51. #define GRAPHICS_MASK    7
  52.  
  53. /* fix until alpha 21 where IP10 will show up in include/sys/invent.h */
  54. #ifndef INV_IP10BOARD
  55. #define INV_IP10BOARD   7
  56. #endif
  57.  
  58. #ifndef TRUE
  59. #define TRUE    1
  60. #endif
  61.  
  62. #ifndef FALSE
  63. #define FALSE    0
  64. #endif
  65.  
  66. #ifndef NULL
  67. #define NULL    0
  68. #endif
  69.  
  70. /* searches inventory list for graphics or cpu options for the Personal IRIS */
  71. long getconfig(int feature)
  72. {
  73.     inventory_t *irec;
  74.  
  75.     setinvent();
  76.  
  77.     while ((irec = getinvent()) != NULL) {
  78.     if (feature & GRAPHICS_MASK && irec->class == INV_GRAPHICS) {
  79.         switch (feature) {
  80.         case TURBO:
  81.             if (irec->state & INV_GR1TURBO)
  82.             return(TRUE);
  83.             break;
  84.         case RE2:
  85.             if (irec->state & INV_GR1RE2)
  86.             return(TRUE);
  87.             break;
  88.         case ZBUFFER:
  89.             if (irec->state & INV_GR1ZBUF24)
  90.             return(TRUE);
  91.             break;
  92.         case BITPLANES:
  93.             if (irec->state & INV_GR1BIT24)
  94.             return(TRUE);
  95.             break;
  96.         case SMALLSONY:
  97.             if (irec->state & INV_GR1SMALLMON)
  98.             return(TRUE);
  99.             break;
  100.         default:
  101.             break;
  102.         }
  103.     }
  104.  
  105.     if (feature == MIPS20 && irec->class == INV_PROCESSOR && 
  106.         irec->class == INV_CPUCHIP && irec->type == INV_IP10BOARD) {
  107.         return(TRUE);
  108.     }
  109.  
  110.     if (feature == MEMORY && irec->class == INV_MEMORY && 
  111.         irec->type == INV_MAIN) {
  112.         return(irec->state);
  113.     }
  114.  
  115.     if (feature == PI && irec->class == INV_PROCESSOR && irec->type == 
  116.         INV_CPUBOARD && (irec->state == INV_IP6BOARD || 
  117.         irec->state == INV_IP10BOARD)) {
  118.         return(TRUE);
  119.     }
  120.  
  121.     if (feature == R2300 && irec->class == INV_PROCESSOR && irec->type ==
  122.         INV_CPUBOARD && irec->state == INV_R2300BOARD) {
  123.         return(TRUE);
  124.     }
  125.        
  126.     }
  127.     return (FALSE);
  128. }
  129.     
  130.